The following example waits for the first captured value:
MAIN.C
void main(void)
{
Cap1_Reset(); /* reset the counter */
err=1;
/* wait until captured value is written to variable Data */
while(err!=ERR_OK);
}
EVENTS.C
word Data;
byte err;
void Cap1_OnCapture(void)
{
/* Write captured value to variable Data */
err=Cap1_GetCaptureValue(&Data);
}
For more about typical usage of the bean code please refer to the page Bean Code Typical Usage.